home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 40
/
Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso
/
Aminet
/
util
/
cli
/
rebootscript.lha
/
Rebootscript
/
RunScript.S
< prev
next >
Wrap
Text File
|
2000-08-24
|
3KB
|
119 lines
;******************************************************************************
; Run script/exe if Writescript was used previously.
; (Compiled with AsmPro V1.16d)
;
; Place this exe-file first in your startup-sequence.
;
; (c) Per Johansson aka Olle^Omen / Latex, Craze, Planet Jazz, Massive
;
; omen@telia.com http://go.to/olle (2000-08-23)
;******************************************************************************
incdir Includes:
include Exec/Exec.I
include Exec/Exec_Lib.I
include Dos/Dos_Lib.I
Start lea.l Pathbuffer,a1
move.l #Readname,d1 ; Open file
bsr.w _Dos_Openfile
move.l #Pathbuffer,d2 ; Fetch path
move.l #256,d3
bsr.w _Dos_Read
bsr.w _Dos_Closefile ; Close file
move.l #Readname,d1 ; Delete it
bsr.w _Dos_Delete
lea.l Pathbuffer,a0 ; Check that it's not zero
tst.b (a0)
beq.w .q
move.l #Pathbuffer,d1 ; Execute!
bsr.w _Dos_Execute
move.l #128,d1 ; Wait a little while
bsr.w _Dos_Delay
bsr.w Reset ; And reset afterwards if need
.q rts
; HWREF-Reset
Reset move.l $4.w,a6
cmp.w #36,LIB_VERSION(a6)
blt .oldexec
jmp -726(a6)
.oldexec lea.l .goaway(pc),a5
jsr _LVOSupervisor(a6)
rts
even
.goaway lea.l MAGIC_ROMEND,a0
sub.l MAGIC_SIZEOFFSET(a0),a0
move.l 4(a0),a0
subq.l #2,a0
reset
jmp (a0)
Xdef _Dos_Openfile
Xdef _Dos_Closefile
Xdef _Dos_Read
Xdef _Dos_Write
Xdef _Dos_Delete
Xdef _Dos_Execute
Xdef _Dos_Getsize
inclink .asm:lo/dos.lnk
;+----------------------------------------------------------------------------+
;| APrintf - Print's the string in a0 to stdout (could be pipe'd) |
;| |
;| In: A0 = String to print! |
;| |
;| Thrashes no registers |
;+----------------------------------------------------------------------------+
APrintf movem.l d0-d7/a0-a6,-(sp)
move.l a0,-(Sp) ; Save Textpointer
moveq.l #0,d0 ; Any version.
lea.l .PDosName(Pc),a1
CALLEXEC OpenLibrary
move.l d0,.PDosBase
beq.w .Fail
move.l (Sp)+,a0 ; Restore Textpointer
move.l a0,a1
moveq.l #0,d3 ; Calculate Size
.Srch tst.b (a0)+
beq.w .Fnd
addq.l #1,d3
bra.w .Srch
.Fnd move.l .PDosBase(Pc),a6
jsr _LVOOutput(a6) ; Get Stdout
move.l d0,d1 ; File (Stdout)
move.l a1,d2 ; Text pointer
jsr _LVOWrite(a6) ; (File=D1,Data=D2,Length=D3)
move.l .PDosBase(Pc),a1
CALLEXEC CloseLibrary
.Fail movem.l (sp)+,d0-d7/a0-a6
rts
.PDosBase dc.l 0
.PDosName dc.b 'dos.library',0
even
Readname dc.b 's:rebootscript.bat',0 ; Filename to read.
even
MAGIC_ROMEND = $01000000
MAGIC_SIZEOFFSET= -$14
section buffers,bss_p
Pathbuffer ds.b 256